﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InTheHand.Net;
using InTheHand.Net.Sockets;
using System.Text.RegularExpressions;

namespace BlueRadar.API
{
    public class Device
    {
        public bool Authenticated { get; set; }
        public string DeviceAddressString { get; set; }
        public string Name { get; set; }
        public BluetoothAddress DeviceAddress { get; set; }
        public DateTime LastSeen { get; set; }
        public DateTime LastUsed { get; set; }
        public string MajorDevice { get; set; }
        public string LastSendStatus { get; set; }
        public List<string> Services { get; set; }
        public bool ObexEnabled { get; set; }

        public double X { get; set; }
        public double Y { get; set; }

        public Device(BluetoothDeviceInfo info, List<string> services)
        {
            this.DeviceAddress = info.DeviceAddress;
            this.DeviceAddressString = info.DeviceAddress.ToString();
            this.Name = info.DeviceName;
            this.Authenticated = info.Authenticated;
            this.LastSeen = info.LastSeen;
            this.LastUsed = info.LastUsed;
            this.LastSendStatus = "N/A";
            this.MajorDevice = info.ClassOfDevice.MajorDevice.ToString();
            this.Services = services;
            if(services.Find(x => x.ToString().Contains("Obex")) != null)
                this.ObexEnabled = true;          
        }
    }
}
